<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>Linux安装使用SVN手册</title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
  <style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
  { position: relative; left: -4em; }
pre.numberSource a.sourceLine::before
  { content: attr(title);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; pointer-events: all; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {  }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
  </style>
</head>
<body>
<h3 id="linux安装使用svn手册">Linux安装使用SVN手册</h3>
<h2 id="section"></h2>
<h4 id="安装svn">1、安装SVN</h4>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" title="1"><span class="co">#以 Ubuntu为例</span></a>
<a class="sourceLine" id="cb1-2" title="2"></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="ex">apt</span> install -y subversion</a></code></pre></div>
<h4 id="创建仓库">2、创建仓库</h4>
<p>完成后，版本库目录下会生成conf（配置文件）、db（数据库）等子目录</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb2-1" title="1"><span class="co">#创建SVN根目录</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="fu">mkdir</span> /data/svn</a>
<a class="sourceLine" id="cb2-3" title="3"><span class="co">#通过svnadmin初始化版本库</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="ex">svnadmin</span> create /data/svn/project01</a>
<a class="sourceLine" id="cb2-5" title="5"><span class="co">#查看创建的SVN版本库目录</span></a>
<a class="sourceLine" id="cb2-6" title="6"><span class="fu">ls</span> /data/svn/project01/</a>
<a class="sourceLine" id="cb2-7" title="7"><span class="ex">conf</span>  db  format  hooks  locks  README.txt</a></code></pre></div>
<h4 id="配置权限和用户">3、配置权限和用户</h4>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb3-1" title="1"></a>
<a class="sourceLine" id="cb3-2" title="2"><span class="co">#主配置文件</span></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="fu">cat</span> /data/svn/project01/conf/svnserve.conf</a>
<a class="sourceLine" id="cb3-4" title="4"></a>
<a class="sourceLine" id="cb3-5" title="5">[<span class="ex">general</span>]</a>
<a class="sourceLine" id="cb3-6" title="6"><span class="ex">anon-access</span> = none      <span class="co"># 禁止匿名访问</span></a>
<a class="sourceLine" id="cb3-7" title="7"><span class="ex">auth-access</span> = write     <span class="co"># 授权用户可写</span></a>
<a class="sourceLine" id="cb3-8" title="8"><span class="ex">password-db</span> = passwd    <span class="co"># 用户密码文件路径</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="ex">authz-db</span> = authz        <span class="co"># 权限控制文件路径</span></a>
<a class="sourceLine" id="cb3-10" title="10"></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#配置用户密码文件</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="fu">cat</span> /data/svn/project01/conf/passwd</a>
<a class="sourceLine" id="cb3-13" title="13"></a>
<a class="sourceLine" id="cb3-14" title="14">[<span class="ex">users</span>]</a>
<a class="sourceLine" id="cb3-15" title="15"><span class="ex">admin</span> = 123456</a>
<a class="sourceLine" id="cb3-16" title="16"><span class="ex">964827</span> = 123456</a>
<a class="sourceLine" id="cb3-17" title="17"></a>
<a class="sourceLine" id="cb3-18" title="18"><span class="co">#配置权限组文件</span></a>
<a class="sourceLine" id="cb3-19" title="19"><span class="fu">cat</span> /data/backup_svn/test/conf/authz</a>
<a class="sourceLine" id="cb3-20" title="20"></a>
<a class="sourceLine" id="cb3-21" title="21">[<span class="ex">groups</span>]</a>
<a class="sourceLine" id="cb3-22" title="22"><span class="ex">admin</span> = admin</a>
<a class="sourceLine" id="cb3-23" title="23"><span class="ex">user</span> = 964827</a>
<a class="sourceLine" id="cb3-24" title="24">[/]</a>
<a class="sourceLine" id="cb3-25" title="25"><span class="ex">*</span> =</a>
<a class="sourceLine" id="cb3-26" title="26"><span class="ex">964827</span> = r</a>
<a class="sourceLine" id="cb3-27" title="27"><span class="ex">@admin</span> = rw</a></code></pre></div>
<h4 id="启动svn服务">4、启动SVN服务</h4>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb4-1" title="1"><span class="co">#-d表示后台运行，-r指定版本库根目录</span></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="ex">svnserve</span> -d -r /data/svn/project01 --listen-port=3690</a></code></pre></div>
</body>
</html>
